#pragma once

#include "Drawable.h"
#include "Common.h"

class CPhysics
{
private:

	static const int sc_iMaxContacts = 8;
	
	dWorldID m_world;	//ODE world for rigid bodies
	dSpaceID m_space;	//ODE space for collision detection
	dJointGroupID m_joints;	//ODE joints group for physics modelling
	dJointGroupID m_jointsStatic;	//joints that are present during whole game, ex. track of a bat
public:
	CPhysics(void);
	~CPhysics(void);

	int Init();
	int Close();
	int Step();

	//callback called by ODE to every two objects which are supposed to collide
	static void CollisionCallback(void *pData, dGeomID geom1, dGeomID geom2);
	static int GetBodyType(dBodyID body);

	dWorldID GetWorld(){return m_world;}
	dSpaceID GetSpace(){return m_space;}
	dJointGroupID GetJoints(){return m_joints;}
	dJointGroupID GetJointsStatic(){return m_jointsStatic;}
};
